Skip to content

fix(installer): explain how to enable multi-user mode - #847

Open
bearyjd wants to merge 1 commit into
Ark0N:masterfrom
bearyjd:installer-multiuser-warning
Open

bearyjd wants to merge 1 commit into
Ark0N:masterfrom
bearyjd:installer-multiuser-warning

Conversation

@bearyjd

@bearyjd bearyjd commented Nov 22, 2026

Copy link
Copy Markdown

Summary

The installer now explains that creating named accounts does not enable multi-user mode. Its completion screen shows how to create the first admin and enable multi-user mode for manual starts and managed services.

This addresses the setup where an operator installs in single-user mode, adds named accounts later, and still sees no named-user login prompt because the existing service starts without multi-user mode.

Verification

  • bash -n install.sh
  • git diff --check

@Ark0N

Ark0N commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Thanks for this, bearyjd. The PR adds a block to the installer's done screen saying that named accounts only take effect once the server runs in multi-user mode, and how to turn that on.

The problem is real. A single-user server never reads users.json, so accounts made with codeman users add do nothing until --multiuser or CODEMAN_MULTIUSER=1 is set. Your order is right too: I checked that codeman web --multiuser refuses to start with no accounts, and starts once codeman users add alice --admin has run. A few things need to change before this goes in.

1. Build the manual start line from start_command_hint (install.sh:4421). CLAUDE.md says to compose the hand-start environment only in start_command_hint/export_bind_env. The test in test/install-sh-invariants.test.ts ("composes the hand-start environment in one place") is there because the installer used to print a bare codeman web under URLs that had a sub-path or a custom port. Take a LAN install with port 4000 and /codeman: the screen prints the correct CODEMAN_HOST=0.0.0.0 ... CODEMAN_PORT=4000 codeman web start line, then "(a bare 'codeman web' binds 127.0.0.1, this machine only)", and then your line suggests a bare codeman web --multiuser, which serves on 127.0.0.1:3000 at /. Please print $(start_command_hint) --multiuser instead (the hint always ends in codeman web), and add an assertion for the new line to that test.

2. Print service steps that take effect (install.sh:4421). On systemd, if you edit ~/.config/systemd/user/codeman-web.service and then run systemctl --user restart codeman-web from the Manage line, systemd keeps the old environment until systemctl --user daemon-reload runs. The operator is then back in the situation this PR is about. print_done_screen already knows the supervisor ($svc) and whether a service exists ($launch), so please print the exact steps for that supervisor, and only when a service was set up:

  • systemd: add Environment=CODEMAN_MULTIUSER=1 under [Service], then systemctl --user daemon-reload && systemctl --user restart codeman-web
  • LaunchAgent: add <key>CODEMAN_MULTIUSER</key><string>1</string> to EnvironmentVariables in ~/Library/LaunchAgents/com.codeman.web.plist, then the unload/load pair from the Manage lines

When there is no service, the start line from item 1 is enough.

3. Make the installer keep that edit (read_existing_binding at install.sh:2348, setup_launchd_service at install.sh:3566, setup_systemd_service at install.sh:3691). Both setup functions rewrite the whole file, and read_existing_binding only carries over the host, password, unauthenticated ack, base URL and port. So every reconfiguring re-run (--lan, --local, --tailscale, --port, --password, --service, --name, and install.sh tailscale when the sub-path changes) silently drops CODEMAN_MULTIUSER=1, and the server comes back single-user. I reproduced this with a --port 4000 re-run against a unit that had the line. The Tailscale route sets no password, so on that route the result is no login at all on a tailnet the team shares. Please handle it the same way the installer handles CODEMAN_BASE_URL:

  • an EXISTING_MULTIUSER="0" next to EXISTING_BASE_URL near the top of the file and in read_existing_binding's reset line
  • set from the unit (grep -Eq '^Environment="?CODEMAN_MULTIUSER=(1|true)"?$') and from the plist (<key>CODEMAN_MULTIUSER</key>)
  • written back by both setup functions

Then add a test in test/install-sh-invariants.test.ts that drives a re-run in real bash, like the drivers already in that file.

4. Drop "Stop the running server before adding the first admin" (install.sh:4420). codeman users add is meant to run while the server is up (src/user-store.ts:4-7: writes are atomic and the cache lasts one second, so the CLI and the server can both write the file). What matters is the opposite order: the admin has to exist before the multi-user start. Something like "Create the first admin with codeman users add <name> --admin, then restart with multi-user on (it will not start without an account)" covers it.

5. Two smaller things (install.sh:4419).

  • The block prints on every install and every update, in the bold yellow this screen uses for real problems ("The service was set up but is not running yet"). It also prints on servers already in multi-user mode, where "add the first admin" does not apply. Once item 3 is in, please skip the block when EXISTING_MULTIUSER is set, and give it a plain ${BOLD} label like the lines around it.
  • The other labels are padded to ten characters, so their text starts in column 14, which is also where your continuation lines start. "Multi-user setup" pushes the first line out to column 22. A short label such as Users, padded the same way, keeps the column.

Once these are fixed, the PR is ready to merge. Thanks again for picking this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants